package org.example.function_interface.Supplier;

import java.util.Random;
import java.util.function.Supplier;

public class SupplierWithConstructorRef {
    public static void main(String[] args) {
        Supplier<Random> s1 = Random::new;
        Random random = s1.get();
        System.out.println(random.nextInt(10));
        Supplier<Book> s2 = Book::new;
        Book book = s2.get();
        System.out.println(book.getBookName());
    }
}

class Book {
    private final String bookName = "Mahabharat";
    public String getBookName(){
        return bookName;
    }
}
/* 输出
9
Mahabharat
*/